package com.arpa.oms.domain.enums;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.enums.IEnum;

import java.util.HashMap;
import java.util.Map;


/**
 * @description
 * 出库单状态
 * @author xuyang
 * @date 2020/11/14
 **/
public enum OmsGoodsRelationStatusEnum implements IEnum<String> {
    /**
     * 分配状态
     */
    ADD("0","新增"),
    UN_DISTRIBUTION("1","待分配"),
    PART_DISTRIBUTION("2","部分分配"),
    DISTRIBUTIONED("3","已分配"),
    VOID("4","已作废"),
    CREATE_WAVE("5","生成波次中"),
    UN_PICKING("6","待拣货"),
    UN_RECHECK("7","待复核"),
    RECHECKING("8","复核中"),
    UN_DELIVERY("9","待出库"),
    DELIVERYING("10","出库中"),
    DELIVERIED("11","出库完成"),
    PICKING("12","拣货中"),
    PICKED("13","拣货完成")

    ;

    /**
     * 值
     */
    private String value;

    /**
     * 描述
     */
    private String desc;

    OmsGoodsRelationStatusEnum(String value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public static String translate(String value){
        OmsGoodsRelationStatusEnum item = ENUM_MAP.get(value);
        if(item != null){
            return item.getDesc();
        }
        return StrUtil.EMPTY;
    }

    private static final Map<String, OmsGoodsRelationStatusEnum> ENUM_MAP = new HashMap();

    static {
        for(OmsGoodsRelationStatusEnum item: values()){
            ENUM_MAP.put(item.getValue(), item);
        }
    }

    public static OmsGoodsRelationStatusEnum getEnumByValue(String value) {
        return ENUM_MAP.get(value);
    }

    @Override
    public String getValue() {
        return value;
    }

    @Override
    public String toString(){
        return this.desc;
    }

    public String getDesc() {
        return desc;
    }
}
